/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package facade;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import modelo.Cliente;
import modelo.Pessoa;
import modelo.Telefone;

/**
 *
 * @author andre
 */
@Stateless
public class TelefoneFacade extends AbstractFacade<Telefone> {
    @PersistenceContext(unitName = "academiawebPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public TelefoneFacade() {
        super(Telefone.class);
    }

    public List<Telefone> findByPessoa(Pessoa pessoa) {
        Query cq = getEntityManager().createNamedQuery("Telefone.findByPessoa");
        cq.setParameter("pessoa", pessoa);
        return (List<Telefone>) cq.getResultList();
    }
    
}
